<?php
/**
* Reads login data for Database
* as like as 
* - host
* - user
* - password
* and save it at the own properties
*/
class PasswordSeeker{
    public $server=""; // Mysql server
    public $username=""; // Mysql Username
    public $password=""; // Mysql Passworl
    public $database=""; // Mysql Database
    private $path_to_ini_file="../_local/config.ini.php";
    /**
    * Open ini file with Mysql connect infromationg, and put this info in to variables
    * 
    */
    function PasswordSeeker($path_to_ini){
        $this->path_to_ini_file=$path_to_ini;
        if(!file_exists($this->path_to_ini_file)){
            die("There is no such file {$this->path_to_ini_file}, cannot get passwords...");
            return false; // may be some day I'll take of die, and this string will be used
        }
        $array_ini=parse_ini_file($this->path_to_ini_file);
	if(!is_array($array_ini)) { throw new Exception("{$this->path_to_ini_file} is not ini no place to get myslq connection data"); }

	if(array_key_exists( "DB_Host",$array_ini)) $this->server=$array_ini["DB_Host"];
	if(array_key_exists( "DB_User",$array_ini))$this->username=$array_ini["DB_User"];
	if(array_key_exists( "DB_Password",$array_ini))$this->password=$array_ini["DB_Password"];
	if(array_key_exists( "DB_Database",$array_ini))$this->database=$array_ini["DB_Database"];
        return true;
    }
}
